﻿using System;

class SurfaceOfTriangle
{
    static void Main()
    {
        Console.WriteLine("Choose one option:");
        Console.WriteLine("Type \"1\" for side and altitude");
        Console.WriteLine("Type \"2\" for three sides");
        Console.WriteLine("Type \"3\" for two sides and angle");

        int choice = int.Parse(Console.ReadLine());

        if (choice == 1)
        {
            AreaOfTriangleBySideAndAltitude();
        }
        else if (choice == 2)
        {
            AreaOfTriangleByThreeSIdes();
        }
        else if (choice == 3)
        {
            AreaOfTriangleByTwoSIdesAndAngle();
        }
    }

    private static void AreaOfTriangleBySideAndAltitude()
    {
        Console.WriteLine("Enter first side:");
        float a = float.Parse(Console.ReadLine());
        Console.WriteLine("Enter altitude:");
        float h = float.Parse(Console.ReadLine());
        float area = a * h / 2;

        Console.WriteLine("The area is :{0}", area);
    }

    private static void AreaOfTriangleByThreeSIdes()
    {
        Console.WriteLine("Enter first side:");
        float a = float.Parse(Console.ReadLine());
        float b = float.Parse(Console.ReadLine());
        float c = float.Parse(Console.ReadLine());
        float p = (a + b + c) / 2;
        double area = Math.Sqrt(p*(p - a) * (p - b) * (p - c));

        Console.WriteLine("The area is :{0}", area);
    }

    private static void AreaOfTriangleByTwoSIdesAndAngle()
    {
        Console.WriteLine("Enter first side:");
        float a = float.Parse(Console.ReadLine());
        Console.WriteLine("Enter second side:");
        float b = float.Parse(Console.ReadLine());
        Console.WriteLine("Enter angle between them in degrees:");
        float alpha = float.Parse(Console.ReadLine());
        double area = a*b*Math.Sin(alpha*Math.PI/180)/2;

        Console.WriteLine("The area is :{0}", area);
    }
}